package com.tedu.bill.demo1;

import java.util.ArrayList;

/**
 * Author：毕龙
 * Date: 2024/5/17 15:43
 */
public class TestCollection2 {
    public static void main(String[] args) {
        //指定具体的类型约束数据的内容
        ArrayList<String> ss = new ArrayList<>();
        ss.add("wangwei" );
        ss.add("hello");
        Person as = new Person<>();
        as.add(new America());
        as.add(123);
        as.add(new Chinese());

        Person<Chinese> cps = new Person<>();
        cps.add(new Chinese());
        //使用泛型时获取数据不需要强制转化
        JSONResult<America> result = new JSONResult<America>();
        result.ok(new America());
        America data = result.getData();
        //使用Object需要强制转化
        JSONResult1 result1 = new JSONResult1();
        result1.ok(new America());
        America america  = (America) result1.getData();

    }
}
